package cn.ad.server.domain.ad;

import com.baidu.bjf.remoting.protobuf.annotation.Protobuf;
import org.joda.time.DateTime;

import java.util.Date;

public class DayTargert {

	@Protobuf
	private int id;
	
	@Protobuf
	private int strategyId;
	
	@Protobuf
	private int monday;// 1
	
	@Protobuf
	private int tuesday;// 2
	
	@Protobuf
	private int wednesday;// 3
	
	@Protobuf
	private int thursday;// 4
	
	@Protobuf
	private int friday;// 5
	
	@Protobuf
	private int saturday;// 6
	
	@Protobuf
	private int sunday;// 7
	private Date createTime;
	private Date updateTime;
	private int status;

	public int ofTodayTarget() {
		DateTime now = DateTime.now();
		switch (now.getDayOfWeek()) {
		case 1:
			return monday;
		case 2:
			return tuesday;
		case 3:
			return wednesday;
		case 4:
			return thursday;
		case 5:
			return friday;
		case 6:
			return saturday;
		default:
			return sunday;
		}
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public int getStrategyId() {
		return strategyId;
	}

	public void setStrategyId(int strategyId) {
		this.strategyId = strategyId;
	}

	public int getMonday() {
		return monday;
	}

	public void setMonday(int monday) {
		this.monday = monday;
	}

	public int getTuesday() {
		return tuesday;
	}

	public void setTuesday(int tuesday) {
		this.tuesday = tuesday;
	}

	public int getWednesday() {
		return wednesday;
	}

	public void setWednesday(int wednesday) {
		this.wednesday = wednesday;
	}

	public int getThursday() {
		return thursday;
	}

	public void setThursday(int thursday) {
		this.thursday = thursday;
	}

	public int getFriday() {
		return friday;
	}

	public void setFriday(int friday) {
		this.friday = friday;
	}

	public int getSaturday() {
		return saturday;
	}

	public void setSaturday(int saturday) {
		this.saturday = saturday;
	}

	public int getSunday() {
		return sunday;
	}

	public void setSunday(int sunday) {
		this.sunday = sunday;
	}

	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public Date getUpdateTime() {
		return updateTime;
	}

	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}

	public int getStatus() {
		return status;
	}

	public void setStatus(int status) {
		this.status = status;
	}

	/**
	 * private int monday;// 1 private int tuesday;// 2 private int wednesday;//
	 * 3 private int thursday;// 4 private int friday;// 5 private int
	 * saturday;// 6 private int sunday;// 7 将时间转换为数组
	 * 
	 * @return
	 */
	public Integer[] toArray() {
		Integer[] integers = new Integer[7];
		integers[0] = this.sunday;
		integers[1] = this.monday;
		integers[2] = this.tuesday;
		integers[3] = this.wednesday;
		integers[4] = this.thursday;
		integers[5] = this.friday;
		integers[6] = this.saturday;
		return integers;
	}

	public boolean equals(Object arg0) {
		if(arg0 instanceof DayTargert){			
			return this.id==((DayTargert)arg0).id;
		}else{
			return super.equals(arg0);
		}
	}
	
	public int hashCode() {
		return id;
	}
}
